Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update fastapi & pydantic #429

Merged
merged 2 commits into from
Aug 25, 2023
Merged

Update fastapi & pydantic #429

merged 2 commits into from
Aug 25, 2023

Conversation

MrCreosote
Copy link
Member

Pydantic v2 has a number of breaking changes.

Also see #428

Pydantic v2 has a number of breaking changes.

Also see #428
@MrCreosote MrCreosote requested a review from Tianhao-Gu August 24, 2023 22:36
Comment on lines -85 to +84
QUERY_VALIDATOR_LOAD_VERSION_OVERRIDE = Annotated[str | None, Query(
QUERY_VALIDATOR_LOAD_VERSION_OVERRIDE = Annotated[str, Query(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Path and Query components, adding None to the type annotation causes the input restrictions not to be shown in the OpenAPI documentation. Not sure why

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it happen with a Optional[Str] Or Union[] ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't try because the current way works well enough for now and I don't want to go back to the Bad Old Ways of type hints

@codecov
Copy link

codecov bot commented Aug 24, 2023

Codecov Report

Patch coverage: 88.09% and project coverage change: -0.05% ⚠️

Comparison is base (d9c5db8) 41.46% compared to head (4d861c9) 41.42%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #429      +/-   ##
==========================================
- Coverage   41.46%   41.42%   -0.05%     
==========================================
  Files          67       67              
  Lines        5496     5492       -4     
==========================================
- Hits         2279     2275       -4     
  Misses       3217     3217              
Files Changed Coverage Δ
src/common/product_models/heatmap_common_models.py 100.00% <ø> (ø)
src/common/storage/init_storage.py 23.52% <ø> (ø)
src/service/data_products/heatmap.py 58.97% <ø> (ø)
src/service/data_products/samples.py 38.84% <ø> (ø)
src/service/routes_collections.py 57.00% <ø> (ø)
src/service/routes_common.py 100.00% <ø> (ø)
src/service/storage_arango.py 24.93% <0.00%> (ø)
src/service/models.py 91.01% <88.46%> (+0.20%) ⬆️
src/service/data_products/common_models.py 97.61% <100.00%> (ø)
src/service/matchers/lineage_matcher.py 38.46% <100.00%> (-1.84%) ⬇️
... and 1 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@Tianhao-Gu Tianhao-Gu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the changes look good. But did you test tool runners with pydantic 2? I know at least microtrait is explicitly using pydantic=1.10.12.

@MrCreosote
Copy link
Member Author

I didn't think of that, but looking at the code changes, they shouldn't break anything since microtrait doesn't actually use the models any more, just the field names. Therefore the imports just need to work.

Would it be ok if I asked you to bump pydantic next time you work on the tools? I've literally never run them so testing them is a bit of a pain for me currently (which at some point I need to fix)

Copy link
Collaborator

@Tianhao-Gu Tianhao-Gu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@MrCreosote MrCreosote merged commit 45c6c3b into main Aug 25, 2023
@MrCreosote MrCreosote deleted the dev-pydantic branch August 25, 2023 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants